package functions;

import javax.swing.JPanel;


import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.Label;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;

import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.UIManager;
import javax.swing.border.BevelBorder;
import javax.swing.border.Border;
import javax.swing.border.SoftBevelBorder;

import views.DayView;

import calendar_ex.Appointment;


public class ViewOptions extends JPanel implements ActionListener {
	
	
		private static final long serialVersionUID = 1L;

		//Appointment add_ap;

		
		JTextField intro;
		

		JPanel cards;
		
		
		private void add_b(JTextArea jt, String s){
			jt.setText(s);
			jt.setBackground(Color.LIGHT_GRAY);
			jt.setBorder(new SoftBevelBorder(BevelBorder.RAISED));
			jt.setFont(new Font("Arial", Font.BOLD, 18));
			
		}
		
		
		
		
		public ViewOptions(){
			
			cards = new JPanel(new CardLayout());
			cards.add(new DayView(), "DAY_VIEW");
			
			intro = new JTextField(15);
			intro.setEditable(true);
			intro.setText("Options");
			intro.setFont(new Font("Courier New", Font.BOLD, 24));
		
			 final String daylist[] = {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"};
			final String monthlist[] = {"1","2","3","4","5","6","7","8","9","10","11","12"};
			final String yearlist[] = {"2009","2010","2011", "2012"};
			final String calenderTypeslist[] = {"ALL", "Uni", "Social","Work"};
			JTable add_ap = new JTable();
			JPanel buttons = new JPanel();
			
			
			final JComboBox day;
			final JComboBox month;
			final JComboBox year;
			JComboBox calType;
			day = new JComboBox(daylist);
			month = new JComboBox(monthlist);
			year = new JComboBox(yearlist);
			calType = new JComboBox(calenderTypeslist);
			
			JButton goTo = new JButton("GOTO");
			goTo.setActionCommand("DAY_VIEW");
			//dayViewBttn.addActionListener(calistener);
			//topPane.add(dayViewBttn, "DAY_VIEW");
			goTo.addActionListener(new ActionListener()
			{
				  public void actionPerformed(ActionEvent e)
				  { CardLayout cl = (CardLayout) (cards.getLayout());
		            String cmd = e.getActionCommand();
		            if (cmd.equals("DAY_VIEW")) {
		                cl.show(cards, "DAY_VIEW");
		            }
				  int dd = Integer.parseInt((String) day.getSelectedItem());
				  int mm = Integer.parseInt((String) month.getSelectedItem());
				  int yyyy = Integer.parseInt((String) year.getSelectedItem());
					   System.out.print("GOTO: ");
					  System.out.print(day.getSelectedItem()+"/");
					  System.out.print(month.getSelectedItem()+"/");
					  System.out.print(year.getSelectedItem());
				    // handle the jbutton event here
					  add(new DayView());
				  } 
				});
			
				
	        
	 
			
			JPanel content = new JPanel(new GridLayout(2,4,10,15));
			content.add(new Label(""));
			
			content.add(new Label("DD"));
			content.add(new Label("MM"));
			content.add(new Label("YYY"));
			content.add(goTo);
			
			content.add(day);
			content.add(month);
			content.add(year);
			

			JPanel content2 = new JPanel(new GridLayout(2,3,10,20));
			content2.add(new Label("Show:"));
			content2.add(new JButton("Calendar Type"));
			content2.add(calType);
			content2.add(new Label(""));
			content2.add(new Label(""));
			
		
			
			JPanel content3 = new JPanel(new GridLayout(2,3,10,20));
			content3.add(new Label(""));
			content3.add(new Label(""));
			content3.add(new Label(""));
			content3.add(new Label("Jump to:"));
			content3.add(new JButton("Busiest Day"));
			content3.add(new JButton("Quietest Day"));
			
			
			add(intro);
			add(content3);
			add(content2);
			add(content);
			add(buttons);
			add(add_ap);
			
		
		
		
		}




		@Override
		public void actionPerformed(ActionEvent arg0) {
			// TODO Auto-generated method stub
			
		}
	}
